package com.munisense.webservices.javaclient;

import java.io.IOException;
import java.util.List;

import javax.xml.bind.JAXBException;

import org.xml.sax.SAXException;

import com.munisense.webservices.pojo.DOIndoorClimate;
import com.munisense.webservices.pojo.DOIndoorClimateList;
import com.munisense.webservices.pojo.DOIndoorClimatePropertyQuery;

/**
 * This is the IndoorClimate service that can be used to fetch/update (lists of)
 * DOIndoorClimate objects.
 * 
 * Currently it is an implementation in it it's most basic form, as a helper
 * class providing a more easy to use interface to the underlying
 * GenericService.
 */
public class DOIndoorClimateService extends GenericService {

	/**
	 * Constructs a new service object. You can do multiple webservice calls
	 * with a single service instance.
	 * 
	 * @param serviceConf
	 *            Configuration of the service
	 */
	public DOIndoorClimateService(ServiceConf serviceConf) {
		super(serviceConf);
	}

	/**
	 * This method does a webservice call to fetch a list of DOIndoorClimate
	 * objects. This list of objects is stored in the DOIndoorClimateList
	 * object.
	 * 
	 * @param fieldsOverride
	 *            Null to use the default fields. Supply an list of property
	 *            names to override the default list of fields.
	 * @param filter
	 *            Null to fetch all the results. Use a filter to limit the
	 *            amount of returned objects.
	 * @return DOIndoorClimateList containing DOIndoorClimate objects
	 * @throws IOException
	 * @throws SAXException
	 * @throws JAXBException
	 */
	public DOIndoorClimateList getList(List<String> fieldsOverride, List<MuniFilter> filter) throws IOException, SAXException, JAXBException {
		return super.getList(DOIndoorClimateList.class, "DOIndoorClimate", fieldsOverride, filter);
	}

	/**
	 * Takes a DOIndoorClimate object and updates the changed values in the
	 * webservice.
	 * 
	 * @param object
	 *            The modified DOIndoorClimate object
	 * @return The saved DOIndoorClimate object
	 * @throws IOException
	 * @throws SAXException
	 * @throws JAXBException
	 */
	public DOIndoorClimate update(DOIndoorClimate object) throws IOException, SAXException, JAXBException {
		return super.update(DOIndoorClimate.class, "DOIndoorClimate", object, Integer.valueOf(object.getId()));
	}

	/**
	 * Fetches a single DOIndoorClimate object from the webservice using it's
	 * id.
	 * 
	 * @param id
	 *            The ID of the IndoorClimate object that needs to be fetched
	 * @param fieldsOverride
	 *            Null to use the default fields. Supply an list of property
	 *            names to override the default list of fields.
	 * @return The DOIndoorClimate object if a match is found
	 * @throws SAXException
	 * @throws JAXBException
	 * @throws IOException
	 */
	public DOIndoorClimate get(int id, List<String> fieldsOverride) throws SAXException, JAXBException, IOException {
		return super.get(DOIndoorClimate.class, "DOIndoorClimate", id, fieldsOverride);
	}

	/**
	 * Method to fetch an list of results for one of the properties of the
	 * DOIndoorClimate object
	 * 
	 * Returns a list of results from an objects property
	 * 
	 * @param id
	 *            The id of the object to fetch
	 * @param property
	 *            Property to query
	 * @param options
	 *            Object containing the query options (May be null)
	 * @return List of results
	 * @throws IOException
	 * @throws SAXException
	 * @throws JAXBException
	 */
	public DOIndoorClimatePropertyQuery propertyQuery(int id, String property, ResultQueryOptions options) throws SAXException, JAXBException, IOException {
		return super.propertyQuery(DOIndoorClimatePropertyQuery.class, "DOIndoorClimate", id, property, options);
	}
}
